function calculateSum(...rest){
    return rest.reduce((total,item)=>total+=item,0)
}
console.log(calculateSum(10,20,30,40));